﻿using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Net;
using System.ServiceModel;
using Model;

namespace PositionServer.Service
{
    [ServiceContract]
    public interface IPositionService
    {
        /// <summary>
        /// return 1 means succeed 85
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        int TestWCF();

        /// <summary>
        /// 在白班夜班状态改变时移除位置服务器中的另一司机
        /// </summary>
        /// <param name="phoneNumber"></param>
        [OperationContract]
        void RemoveCdmaTaxi(string phoneNumber);

        [OperationContract]
        bool UpdatePrivateCarInfosInMemory(PrivateCarInfo model);
  
        [OperationContract]
        void PassengerUpdateInfo(string psgPhoneNum,
        double psgLat, double psgLng, IPAddress psgIp, byte carType);

         
        [OperationContract]
        string SpecialCarRegister(string phoneNumber,
        IPAddress ip, string imei, int version);

        /// <summary>
        /// 更新位置服务器中的车辆签名
        /// </summary>
        /// <param name="phoneNumber"></param>
        /// <param name="signature"></param>
        /// <returns></returns>
        [OperationContract]
        bool UpdateCarSignature(string phoneNumber, string signature);

        /// <summary>
        /// 按车辆类型搜索附近车
        /// </summary>
        /// <param name="phoneNumber">电话号码</param>
        /// <param name="longitude">经度</param>
        /// <param name="latitude">纬度</param>
        /// <param name="distance">范围</param>
        /// <param name="usertype">搜索者所属用户类型</param>
        /// <param name="carType">搜索的车辆的类型</param>
        /// <returns></returns>
        [OperationContract]
        List<TaxiInfo> GetNearbyGpsByCarType(string phoneNumber,
            double longitude, double latitude,
        double distance, int usertype, byte carType);


        [OperationContract]
        List<TaxiInfo> GetNearbyGpsWithStateByCarType(string phoneNumber,
           double longitude, double latitude, double distance, int usertype, byte carType);

         
        /// <summary>
        /// 私家车注册 返回0表示数据库中无此号码，1表示手机号与IMEI不匹配，2表示成功
        /// </summary>
        /// <param name="phoneNumber"></param>
        /// <param name="ip"></param>
        /// <param name="IMEI"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        [OperationContract]
        string PrivateCarRegister(string phoneNumber, IPAddress ip, string IMEI, int version);


        /// <summary>
        /// update Taxi information
        /// </summary>
        /// <param name="taxiInfo"></param>
        [OperationContract]
        void UpdateTaxiInfo(Model.TaxiInfo taxiInfo);

        /// <summary>
        /// UpdateTaxiCallingState
        /// </summary>
        [OperationContract]
        void UpdateTaxiCallingState(string phoneNum, byte state);


        /// <summary>
        /// return nearby TaxiInfo 
        /// </summary>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        /// <param name="distance"> kilometer</param>
        /// <param name="type">0---Taxi,1---PhoneUser</param>
        /// <returns></returns>
        [OperationContract]
        List<Model.TaxiInfo> GetNearbyGps(double longitude, double latitude, int distance, int type);


        ///// <summary>
        ///// Add Trade successful  Info 
        ///// </summary>
        ///// <param name="tradeInfo"></param>
        //[OperationContract]
        //void AddTradeInfo(Model.TradeInfo tradeInfo);


        ///// <summary>
        ///// Add Trade successful  Info
        ///// </summary>
        ///// <param name="taxiGpsHistoryInfo"></param>
        //[OperationContract]
        //void AddTaxiGpsHistoryInfo(Model.TaxiGpsHistoryInfo taxiGpsHistoryInfo);


        /// <summary>
        /// Taxi Registe
        /// </summary>
        /// <param name="phoneNumber"></param>
        /// <param name="ip"> </param>
        /// <param name="IMEI"> </param>
        /// <param name="version"> </param>
        /// <returns></returns>
        [OperationContract]
        bool TaxiRegister(string phoneNumber, IPAddress ip);

        /// <summary>
        /// Taxi Registe
        /// </summary>
        /// <param name="phoneNumber"></param>
        /// <param name="ip"> </param>
        /// <param name="IMEI"> </param>
        /// <param name="version"> </param>
        /// <returns></returns>
        [OperationContract]
        string TaxiRegister2(string phoneNumber, IPAddress ip, string IMEI, int version);


        /// <summary>
        /// AcceptServer Connect
        /// </summary>
        [OperationContract]
        void AsTcpRegister(string webip);

        /// <summary>
        /// TcpClient Count  Add
        /// </summary>
        [OperationContract]
        void AsTcpCountAdd(string webip, string phoneNumber);

        /// <summary>
        /// TcpClient Count  Minus
        /// </summary>
        [OperationContract]
        void AsTcpCountMinus(string webip, string phoneNumber);

        /// <summary>
        /// Set TcpClient Count  0
        /// </summary>
        [OperationContract]
        void AcceptServerlogout(string webip);


        [OperationContract]
        string GetFreeAcceptServerIp(string webip);


        //[OperationContract]
        //DataSet TaxiGetAdSeting(string phoneNumber);

        //[OperationContract]
        //DataSet TaxiGetAreaSeting(string phoneNumber);

        //[OperationContract]
        //int GetRecordCountOfUserInThisMonth(string phoneNumber, int complaintObject);
 

    }
}
